/*
** functions_two.c for bistromathique in /home/labonn_c//Documents/bistromathique
** 
** Made by christophe labonnemartinez
** Login   <labonn_c@epitech.net>
** 
** Started on  Mon Oct 31 16:59:48 2011 christophe labonnemartinez
** Last update Tue Nov  1 12:43:53 2011 christophe labonnemartinez
*/

int	my_getnbr_base(char *str, int base)
{
  int	nbr;
  int	pow;
  int	i;
  int	pos;
  int	stop;
  char	*basestr;

  nbr = 0;
  pow = 1;
  pos = 0;
  while (str[pos] && (pos = pos + 1));
  basestr = "0123456789abcdefijklmnopqrstuvwxyz";
  while (pos-- >= 1)
    {
      i = 0;
      stop = 1;
      while (i < base && stop)
	if (basestr[i + 1] == str[pos])
	  stop = 0;
      if (stop)
	return (nbr);
      nbr = nbr + (i - 1) * pow;
      pow = pow * base;
    }
  return (nbr);
}
